<?php
    $user_name = "SomeUser"; 
    $password = "SomePass";
    $database_name = "SomeDatabase";
    $table_name = "SomeTable"; 



    $key = $_POST["customer_key"];
    
     $dbh = mysqli_connect("localhost", $user_name, $password, $database_name);
    if (!$dbh)
    {
        die("Not connected : " . mysqli_error($dbh));
    }
    else
    {
        $query = "SELECT * FROM total2 WHERE customer_key = '$key'";
        $result = mysqli_query($dbh,$query);if (!$result)
        {
            echo 'Could not run query: ' . mysqli_error($dbh);
        }
        else
        {
            $row = mysqli_fetch_row($result);
            
            if ($row >= 1)
            {
                $query = "DELETE FROM total2 WHERE customer_key = '$key'";
                        
                $result = mysqli_query($dbh,$query);
                echo ("key_removed"); 
                
            }
            else
            {
                echo ("key_not_in_list");                    
            }
        }
        mysqli_close($dbh);                        
    }              
